package com.shixi.shixitraining.shixitraining.ui.tabmine.activity;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageView;

import com.shixi.shixitraining.shixitraining.R;
import com.shixi.shixitraining.shixitraining.base.BaseActivity;
import com.shixi.shixitraining.shixitraining.ui.tabmine.adapter.MyCollectPagerAdapter;
import com.shixi.shixitraining.shixitraining.util.TitleUtil;

public class MyCollectActivity extends BaseActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_collect);
        initTitle();
        initView();
    }




    private void initTitle() {
        TitleUtil titleUtil = new TitleUtil(findViewById(R.id.top_bar_layout));
        titleUtil.initTitle(4, R.id.top_bar_center_tv, R.id.top_bar_left_img, 0, R.drawable.icon_back,
                0, "我的收藏", "", "");

        ImageView mBackImg = (ImageView) findViewById(R.id.top_bar_left_img);
        mBackImg.setOnClickListener(this);


    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.top_bar_left_img:
                this.finish();
                break;
        }
    }


    private void initView() {
        TabLayout mTab = (TabLayout) findViewById(R.id.tab_collect);
        ViewPager mViewPager = (ViewPager) findViewById(R.id.viewpager_collect);
        mTab.setTabMode(TabLayout.MODE_FIXED);
        mTab.setupWithViewPager(mViewPager);

        MyCollectPagerAdapter adapter=new MyCollectPagerAdapter(getSupportFragmentManager());
        mViewPager.setAdapter(adapter);

    }
}
